#ifndef __RECORD_AVI_H__
#define __RECORD_AVI_H__
#include <pthread.h>

#include <libmedia/encode/hw_h264_video_encoder.h>
#include <libmedia/media_packet.h>

#include <utils/avilib.h>

struct st_avi {
    avi_t* avi_writer;
};

struct st_record {
    struct hw_h264_video_encoder_param h264_param;
    struct video_encoder* h264_video_encoder;

    struct st_avi avi;
	int width;
	int height;
	uint64_t frame_cnt;
	uint64_t start_time;
	uint64_t end_time;
    uint64_t  duration;

    pthread_rwlock_t rw_lock;
    bool record_state;

};

extern int media_encoder_open(int width, int height);
extern void media_encoder_close(void);
extern void media_record_stop(void);
extern int do_media_record(struct video_frame* frame);
extern int media_record_start(const char* record_dir, const char* name, int width, int height);
#endif